(Fcurrent_time_zone) [HAVE_TM_ZONE || HAVE_TZNAME]:
authorGerd Moellmann <gerd@gnu.org>
Fri, 2 Mar 2001 12:56:48 +0000 (12:56 +0000)
committerGerd Moellmann <gerd@gnu.org>
Fri, 2 Mar 2001 12:56:48 +0000 (12:56 +0000)
Accept only alphanumeric time zone names.

src/editfns.c

index 2f5e3f711ea4000db46089a6fe4448827372ac6d..d8f03114b4e3a1bd122bd91f30e0dfa2fb348e16 100644 (file)
@@ -1757,6 +1757,20 @@ the data it can't find.")
        s = tzname[t->tm_isdst];
 #endif
 #endif /* not HAVE_TM_ZONE */
+
+#if defined HAVE_TM_ZONE || defined HAVE_TZNAME
+      if (s)
+       {
+         /* On Japanese w32, we can get a Japanese string as time
+            zone name.  Don't accept that.  */
+         char *p;
+         for (p = s; *p && isalnum (*p); ++p)
+           ;
+         if (p == s || *p)
+           s = NULL;
+       }
+#endif
+
       if (!s)
        {
          /* No local time zone name is available; use "+-NNNN" instead.  */